home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / small_c.arc / READ.ME < prev    next >
Encoding:
Text File  |  1986-10-21  |  10.4 KB  |  199 lines

  1.          This diskette contains version 2.1 of the Small-C  compiler  for
  2.          use with MS/PC-DOS 2.1 or later -- It makes use of MASM and LINK
  3.          and includes  a full library of UNIX/C functions.  The following
  4.          files are included:
  5.          
  6.             READ.ME       This documentation.
  7.             CC.EXE        Executable Small-C compiler.
  8.             AR.EXE        Executable archive maintainer.
  9.             CLIB.LIB      Small-C relocatable library for use with LINK.
  10.             STDIO.H       Standard header file for all compiles.
  11.             AR.C          Archive maintainer source.
  12.             CC.ARC        Small-C compiler source code archive.
  13.             CLIB.ARC      Small-C library source code archive.
  14.          
  15.          This software is fully documented in "The Small-C  Handbook"  by
  16.          James  E.  Hendrix  (Reston  Publishing  Co.,  Reston, VA, March
  17.          1983).  The Handbook  was  writtten  for  the  CP/M  version  of
  18.          Small-C,  however,  an MS/PC-DOS specific addendum is available.
  19.          Copies of these can be obtained  from  Dr.Dobb's  Journal,  2464
  20.          Embarcadero Way, Palo Alto, CA 94303.
  21.          
  22.          The  compiler  takes  in  a  subset of the syntax for the full C
  23.          language, and generates Intel assembly language mnemonics.    It
  24.          supports only  integer  and  character  data  types.  Arrays are
  25.          limited to one  dimension.    It  does  not  support  arrays  of
  26.          pointers, structures,  or  unions.    Also  missing  are sizeof,
  27.          casts, #if expr, #undef, and  #line.    External  functions  are
  28.          automatically  declared, but external variables must be declared
  29.          explicitly.  Functions always return integer  values.    Globals
  30.          may  be  initialized  using  the  =  syntax,  but locals cannot.
  31.          Locals are always automatic, and the  specifiers  auto,  static,
  32.          extern,  register,  and  typedef  are  not accepted at the local
  33.          level.  Only extern is accepted at the global level.   Character
  34.          variables  are  expanded with sign-extension when they appear in
  35.          expressions; character constants are not.    Avoid  using  names
  36.          which begin with the underscore character since they are used by
  37.          system functions   in  the  library.   Examples of invoking  the 
  38.          compiler follow:
  39.          
  40.            CC                       compile console input
  41.                                     giving console output
  42.          
  43.            CC <FILE1 -L1 -P         compile FILE1 giving console
  44.                                     output, list the source as
  45.                                     comments in the output, and
  46.                                     pause on errors
  47.          
  48.            CC <FILE1 >FILE2 -M      compile FILE1 giving FILE2
  49.                                     and monitor progress by
  50.                                     listing function headers on
  51.                                     the console
  52.          
  53.            CC FILE1 FILE2 >FILE3    compile FILE1 then FILE2 into
  54.                                     a single program in FILE3
  55.          
  56.            CC FILE1                 compile FILE1 (default ext. C)
  57.                                     giving FILE1 (ext. ASM)
  58.          
  59.            CC FILE1 FILE2           compile FILE1 then FILE2 (default
  60.                                     ext. C) giving FILE1 (ext. ASM)
  61.          
  62.          Any number of files may be concatenated as input by listing them
  63.          in the  command  line; in that case stdin is not used.  Standard
  64.          DOS  file  specifications,  including   logical   devices,   are
  65.          accepted.  The listing switch has two forms:
  66.          
  67.  
  68.              -L1   lists on stdout (with output) as comments
  69.              -L2   lists on stderr (always the console)
  70.          
  71.          Pressing control-S makes the compiler pause until another key is
  72.          pressed, and control-C aborts the run.  Enter  a  CR  to  resume
  73.          execution after a pause because of a compile error.  If input is
  74.          from  the  keyboard,  control-Z indicates end-of-file, control-X
  75.          rubs out  the  pending  line,  and  BS  rubs  out  the  previous
  76.          character.   If  the  compiler  aborts  with the letter M on the
  77.          screen, there is insufficient memory to run it; however,  a  64K
  78.          system should suffice.
  79.          
  80.          The easiest way to compile a program is simply:
  81.          CC MYPROG.C -M -A -P
  82.  
  83.          This  will result in a  file called  MYPROG.ASM.  You must still
  84.          assemble it and link it to the function library  using MASM  and
  85.          LINK from your DOS disk:
  86.  
  87.          MASM MYPROG,MYPROG,NUL,NUL  to assemble it, then:
  88.  
  89.          LINK MYPROG, MYPROG, NUL, CLIB.LIB to link it.
  90.          
  91.          Comments  in  the  front  of  AR.C describe the operation of the
  92.          archive maintainer AR.COM. To extract all of the modules out  of
  93.          the archives, put AR.EXE and CC.ARC  (or CLIB.ARC) on a new disk
  94.          and enter the commands:
  95.                            AR -X CC.ARC 
  96.                            AR -X CLIB.ARC
  97.          
  98.          The function fflush() has been droppped from this implementation
  99.          of  Small-C.  Since  all  I/O  is through the new (with DOS 2.0)
  100.          "file handle" facility and no provision is made for forcing  DOS
  101.          to flush its buffers, this function could not be supported.
  102.          
  103.          The ternary operator (?:) is supported.
  104.          
  105.          Octal and  hexadecimal  constants  are supported.  Note that the
  106.          subscripts in The Small-C Handbook  on  page  160  have  leading
  107.          zeroes.  This has been corrected in your source.
  108.          
  109.          The code generating logic in the compiler has been improved over
  110.          that given in the Handbook.
  111.          
  112.          - auxbuf (fd, size) int fd, size;
  113.            
  114.            This  Small-C  function  allocates an auxiliary buffer of size
  115.            bytes for fd.  It returns zero on success and ERR on  failure.
  116.            Fd  need not be open; however, for compatibility with the CP/M
  117.            implementation, you should call auxbuf() only on an  open  fd.
  118.            Size  must  be  greater  than zero and less than the amount of
  119.            free memory.  If fd is a device, the buffer is  allocated  but
  120.            ignored.   This  implementation  of Small-C uses "file handle"
  121.            calls to DOS; it reads and writes in chunks the  size  of  the
  122.            auxiliary buffer.   Extra buffering is useful in reducing disk
  123.            head movement or drive switching during sequential operations.
  124.            Once an auxiliary  buffer  is  allocated  it  sticks  for  the
  125.            duration of  program execution, even if fd is closed.  Calling
  126.            this function a second  time  for  the  same  fd  is  allowed,
  127.            however,  the  original  buffer  continues  to occupy space in
  128.            allocated memory.  Alternating read and write  operations  and
  129.            performing seeks with auxiliary buffering is also allowed, but
  130.            is  also  incompatible  with  CP/M.  Ungetc()   will   operate
  131.            normally.   Ordinarily,  it  is counter productive to allocate
  132.            auxiliary buffers to both input and output files.
  133.            
  134.          - bseek(fd, offset, base) int fd, offset[], base;
  135.            
  136.            This Small-C function positions the DOS file pointer for fd to
  137.            the byte  indicated  by  the  double  length  integer  offset.
  138.            Offset  must  be  given  as  the  address  of  an array of two
  139.            interers such  that  offset[0]  is  the  low  order  half  and
  140.            offset[1] is  the  high  order half.  Base determines the base
  141.            location from which the offset is applied.  It may have any of
  142.            the following values:
  143.            
  144.                          BASE OFFSET-RELATIVE-TO
  145.                            0      beginning of file
  146.                            1      current byte in file
  147.                            2      end of file (minus offset)
  148.            
  149.            Bseek() returns NULL on success, otherwise EOF. It works  like
  150.            the UNIX function fseek() except that the offset is an address
  151.            instead of  the actual value.  This is necessary since Small-C
  152.            does not presently support long variables.
  153.            
  154.            
  155.          - btell(fd, offset) int fd, offset[];
  156.            
  157.            This Small-C function tells the offset to the current byte  in
  158.            the file  indicated  by  fd.  The current byte is the next one
  159.            that will be read from or written to the file.  No account  of
  160.            ungetc() calls  is  taken.   Offset is a double length integer
  161.            and must be specified as  the  address  of  an  array  of  two
  162.            interers  such  that  offset[0]  is  the  low  order  half and
  163.            offset[1] is the  high  order  half.    The  array  at  offset
  164.            receives  the  offset  value  of the current byte in the file.
  165.            Btell returns NULL on success, otherwise ERR.
  166.            
  167.            
  168.          - ctellc(fd) int fd;
  169.            
  170.            This Small-C  function  returns  the  offset  (0-127)  to  the
  171.            current byte  in  the current record for fd.  The current byte
  172.            is the next one that will be read from or written to the file.
  173.            No account of ungetc() calls is taken.
  174.            
  175.            
  176.          - cseekc(fd, offset) int fd, offset;
  177.            
  178.            This Small-C function positions fd on the character  indicated
  179.            by offset within current 128-byte record.   The  current  byte
  180.            must be  on  a  record  boundary.    Used  in combination with
  181.            cseek() this function allows you to seek to a given byte in  a
  182.            file  by  tracking  file  positions  in  two parts, the record
  183.            offset and the  byte  offset  within  the  record.    Cseekc()
  184.            returns NULL on success, otherwise EOF.
  185.            
  186.            
  187.          - pad (str, ch, n) char *str, ch; int n;
  188.            
  189.            This   Small-C  function  fills  the  string  at  str  with  n
  190.            occurrences of the character ch.
  191.            
  192.            
  193.          - rename (old, new) char *old, *new;
  194.            
  195.            This Small-C function changes the name of the  file  specified
  196.            by old  to  the  name  indicated  by  new.  It returns NULL on
  197.            success, otherwise ERR.
  198.  
  199.